<template>
    <div class="Box">
        <router-link :to="{ path:'/video',query:{ avid:props.aid,bvid:props.bvid,cid:props.mid } }" target="_blank" class="img">
            <img :src="props.pic" alt="图片加载中"/>
        </router-link>
        <div class="info">
            <router-link :to="{ path:'/video',query:{ avid:props.aid,bvid:props.bvid,cid:props.mid } }" target="_blank">{{ props.title }}</router-link>
            <p class="label">{{ props.desc }}</p>
            <div class="videoInfo">
                <p>
                    <img src="@/assets/videoIcon/PlayBlack.png">
                    <span>{{ formatNum(props.play) }}</span>
                </p>
                <p>
                    <img src="@/assets/videoIcon/danmaku.png">
                    <span>{{ formatNum(props.danmaku) }}</span>
                </p>
                <p>{{ formatIsYMD(props.created) }}</p>
            </div>

        </div>
    </div> 
</template>

<script lang="ts" setup>
import { formatNum,formatIsYMD,voideoAllTime,formatStrVideoTime } from '@/utils/format'
import { useRouter } from 'vue-router'
interface Props{
    bvid:string
    aid:number           //avid
    mid:number          
    created:number      //创建时间
    title:string        //标题
    desc:string
    play:number          //播放量
    danmaku:number
    pic:string
}
const props = defineProps<Props>()
const router = useRouter()

function goVideo(){
    let routeData = router.resolve({path:'/video',query:{'avid':props.aid,'bvid':props.bvid,'cid':props.mid}})
    window.open(routeData.href, '_blank');
} 
</script>

<style lang="scss" scoped>
p{
    padding: 0;
    margin: 0;
}
.Box{
    width: 100%;
    padding: 20px 0;
    box-sizing: border-box;
    height: 170px;
    @include flexRowCenter;
    gap: 0 20px;
    border-bottom: 1px solid var(--el-border-color);
}
.img{
    position: relative;
    height: 130px;
    & img{
        width: 190px;
        height: 100%;
        border-radius: 4px;
    }
}
.info{
    height: 100%;
    width: calc(100% - 210px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: start;
    gap: 15px 0;
    & a:nth-child(1){
        color: #222222;
        font-size: 16px;
        width: 100%;
        text-align: left;
        @include noWrap;
    }
    & a:nth-child(1):hover{
        color: #00A1D6;
    }
}
.label{
    font-size: 13px;
    line-height: 16px;
    max-height: 48px;
    color: #99A2AA;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}
.videoInfo{
    display: flex;
    align-items: center;
    justify-content: start;
    gap: 0 20px;
    color: #6D757A;
    font-size: 13px;
    & p{
        line-height: 20px;
        @include flexRowCenter;
        gap: 3px;
    }
    & p:nth-child(1) img{
        width: 15px;
        height: 14px;
    }
    & p:nth-child(2) img{
        width: 20px;
        height: 22px;
    }
    & p:last-child{
        color: #6D757A;
    }
}
</style>